//设置环境
define('ENVIRONMENT', 'development');
//以哪种环境生产
if(define('ENVIRONMENT')) {
	switch (ENVIRONMENT) {
		case 'development':
			error_reporting(E_ALL);
			break;
		case 'testing':
		case 'production':
			error_reporting(0);
			break;
		default:
			exit('The application environment is not set correctly');
	}
}
//定义系统文件名
$system_path = 'system';

//应用文件夹名
$application_folder = 'web';

//设置system_path 目录
//
if(defined('STDIN')) {
	chdir(dirname(__FILE__));
}

if(realpath($system_path) !== FALSE) {
	$system_path = realpath($system_path).'/';
}
//Is the system path correct?
if( ! is_dir($system_path)) {
	exit("Your system folder path does not appear to be set correctly, Please open the following and correct this:".pathinfo(__FILF,PATHINFO_BASENAME));
}

//定义普通常量

//The name fo THIS file
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));

//This global constant is depercated
define('BASEPATH', str_replace("\\", '/', $system_path));

//Path to the front controller (this files)
define('FCPATH', str_replace(SELF, '', __FILE__));

//name of the "system folder"
define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));

//The path to the "application" folder
if(is_dir($application_folder)) {
	define('APPPATH', $application_folder.'/');
} else {
	if(!is_dir(BASEPATH.$application_folder.'/')) {
		exit("Your application folder path does not appear");
	}
	
	define('APPPATH', BASEPATH.$application.'/');
}

require_once BASEPATH.'core/CodeIgniter.php';
